<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>ECharts</title>
    <!-- 引入刚刚下载的 ECharts 文件 -->
    <script src="{{url_for('static', path='/layui/echarts.min.js')}}"></script>
</head>
<body>
<!-- 为 ECharts 准备一个定义了宽高的 DOM -->
{% for i in [1,2,3,4]%}
<div id="main{{i}}" style="width: 600px;height:400px;"></div>
<script type="text/javascript">
    var myChart = echarts.init(document.getElementById('main{{i}}'));
    var option = {
        title: {
            text: 'ECharts 入门示例'
        },
        tooltip: {},
        legend: {
            data: ['销量']
        },
        xAxis: {
            data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
        },
        yAxis: {},
        series: [
            {
                name: '销量',
                type: 'bar',
                data: []
            }
        ]
    };
    myChart.setOption(option);
    myChart.showLoading();
    let json = {};
    $.ajax(
        {
            type: "post",
            url: "/analysis/query/result/id",
            contentType: "application/json",
            data: {'title': 1},
            dataType: "JSON",
            success: function (result) {
                json = JSON.parse(result)
                myChart.hideLoading();    //隐藏加载动画
                myChart.setOption({        //加载数据图表
                    series: [
                        {
                            name: '销量',
                            type: 'bar',
                            data: json.data
                        }
                    ]
                });
            }
        }
    )
</script>
{% endfor %}
</body>
scri
</html>